<?php

namespace App\Services;

use App\Services\Base\CacheService;

class GlobalConfigService
{

    public static function get($key, $default = "")
    {
        $data = CacheService::get("pf:config");
        $ret = "";
        if ($data) {
            if (is_array($key)) {
                $ret = [];
                foreach ($key as $v) {
                    $ret[$v] = $data[$v] ?? $default;
                }
            } else {
                $ret = $data[$key] ?? $default;
            }
        } else {
            $ret = $default;
        }
        return $ret;
    }
}
